home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Commands
/
Commander.h
< prev
next >
Wrap
Text File
|
2000-06-23
|
793b
|
37 lines
// Commander.h
#ifndef Commander_h
#define Commander_h
#ifndef Assert_h
#include "Assert.h"
#endif
#ifndef CommandLink_h
#include "CommandLink.h"
#endif
template < class Protocol >
class Commander
{
private:
typedef CommandLink< Protocol > LinkType;
public:
Commander()
{
Assert( LinkType::ActiveHandler() != 0 );
}
Protocol& operator*() { Assert( !Null() ); return *LinkType::ActiveHandler(); }
Protocol *operator->() { Assert( !Null() ); return LinkType::ActiveHandler(); }
const Protocol& operator*() const { Assert( !Null() ); return *LinkType::ActiveHandler(); }
const Protocol *operator->() const { Assert( !Null() ); return LinkType::ActiveHandler(); }
static bool Null() { return LinkType::ActiveHandler() == 0; }
};
#endif